<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../css/layui.css" media="all">
    <link rel="stylesheet" href="../css/admin.css" media="all">
    <link rel="stylesheet" href="../css/custom.css" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<div class="cus-fluid">
    <div class="cus-content">
        <div class="layui-btn-group demoTable" style="margin-bottom: 10px;">
            <button class="layui-btn" data-type="parseTable">立即转化为数据表格</button>
        </div>

        <table lay-filter="parse-table-demo">
            <thead>
            <tr>
                <th lay-data="{field:'username', width:200}">昵称</th>
                <th lay-data="{field:'joinTime', width:150}">加入时间</th>
                <th lay-data="{field:'sign', minWidth: 180}">签名</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>贤心1</td>
                <td>2016-11-28</td>
                <td>人生就像是一场修行 A</td>
            </tr>
            <tr>
                <td>贤心2</td>
                <td>2016-11-29</td>
                <td>人生就像是一场修行 B</td>
            </tr>
            <tr>
                <td>贤心3</td>
                <td>2016-11-30</td>
                <td>人生就像是一场修行 C</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>

<script src="../layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use('table', function () {
        var table = layui.table;

        var $ = layui.$, active = {
            parseTable: function () {
                table.init('parse-table-demo', { //转化静态表格
                    //height: 'full-500'
                });
            }
        };

        $('.demoTable .layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>

</body>
</html>
